package com.css.zfzx.sjcj.modules.drill.repository;

import com.css.zfzx.sjcj.modules.drill.Entity.QhY18Entity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Description
 * @Author zyc
 * @Date 2021/1/15 17:09
 * @Version V1.0
 */
public interface QhY18Repository extends JpaRepository<QhY18Entity, String> {
    QhY18Entity findByIdAndIsValid(String id, String isValid);

    QhY18Entity findByDrillIdAndIsValid(String drillId, String isValid);

    @Modifying
    @Query(nativeQuery = true,value = "update qh_y18 set is_valid='0' where drill_id in :drillIds")
    void deleteAllByDrillIdIn(List<String> drillIds);

    /**
     * 根据场地类别和删除标识查询
     */
    List<QhY18Entity> findAllBySiteTypeAndIsValid(String siteType, String isValid);
}
